import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Date: 2024-01-20
 * Time:18:48
 */


public class Main {
    //确定是哪种用户
    public static User login() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的姓名");
        String name = scanner.nextLine();
        System.out.println("请输入用户类型：1.普通用户 2.管理员");
        int choice = scanner.nextInt();
        if(choice == 1) {
            return new NormalUser(name);
        } else {
            return new AdminUser(name);
        }
    }

    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = login();
        while (true) {
            int choice = user.menu();
            System.out.println("choice:" + choice);
            user.doOperation(choice,bookList);
        }
    }
}
